/*
 * This file Copyright (c) 2015. Walle.
 * (http://www.wallellen.com). All rights reserved.
 *
 *
 * This file is dual-licensed under both the
 * Walle Agreement (WA) and the GNU General Public License.
 * You may elect to use one or the other of these licenses.
 *
 * This file is distributed in the hope that it will be
 * useful, but AS-IS and WITHOUT ANY WARRANTY; without even the
 * implied warranty of MERCHANTABILITY or FITNESS FOR A
 * PARTICULAR PURPOSE, TITLE, or NONINFRINGEMENT.
 * Redistribution, except as permitted by whichever of the GPL
 * or WA you select, is prohibited.
 *
 * 1. For the GPL license (GPL), you can redistribute and/or
 * modify this file under the terms of the GNU General
 * Public License, Version 3, as published by the Free Software
 * Foundation.  You should have received a copy of the GNU
 * General Public License, Version 3 along with this program;
 * if not, write to the Free Software Foundation, Inc., 51
 * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * 2. For the Walle Agreement (WA), this file
 * and the accompanying materials are made available under the
 * terms of the WA which accompanies this distribution, and
 * is available at http://www.wallellen.com/agreement.html
 *
 *
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
 */

package com.wallellen.knowledge.doc.server;

import com.wallellen.core.auth.domain.LoginUser;
import com.wallellen.core.sql.query.DataQuery;
import com.wallellen.core.sql.result.DataResult;
import com.wallellen.knowledge.doc.domain.DocMessage;

/**
 * 留言板
 *
 * @author <a href="mailto:wallellen@hotmail.com">WALLE</a>
 */
public interface DocmessageManagerInter {
    /**
     * 发送消息
     *
     * @param readUserId 收件人
     * @param text       内容
     * @param title      主题
     * @param note       备注
     * @param appId      应用id
     * @param sendUser   发送人
     * @return
     */
    public DocMessage sendMessage(String readUserId, String text, String title, String note, String appId,
                                  LoginUser sendUser);

    /**
     * 发送消息
     *
     * @param readUserId 收件人
     * @param text       内容
     * @param title      主题
     * @param note       备注
     * @param sendUser   发送人
     * @return
     */
    public DocMessage sendMessage(String readUserId, String text, String title, String note, LoginUser sendUser);

    /**
     * 回复消息
     *
     * @param entity
     */
    public DocMessage reSendMessage(String messageId, String text, LoginUser sendUser);

    /**
     * 删除消息
     *
     * @param entity
     */
    public void deleteMessage(String messageId, LoginUser user);

    /**
     * 阅读消息
     *
     * @param id
     * @return
     */
    public DocMessage readMessage(String messageId);

    /**
     * 获得没有阅读的消息数量
     *
     * @param user
     * @return
     */
    public int getNoReadMessageNum(LoginUser user);

    /**
     * 查询消息列表
     *
     * @param query 传入的查询条件封装
     * @return
     */
    public DataQuery createMessageQuery(DataQuery query);

    /**
     * 获得消息
     *
     * @param id
     * @return
     */
    public DocMessage getMessage(String messageId);

    /**
     * 发表一篇业务留言
     *
     * @param content  内容（被显示的）
     * @param title    主题
     * @param mark     留言的类型标签
     * @param appid    业务主键（按照该键可以找到业务得留言）
     * @param sendUser 发表人
     * @return
     */
    public DocMessage sendAnswering(String content, String title, String mark, String appid, LoginUser sendUser);

    /**
     * 获得文档所有评论
     *
     * @param docid    文档id
     * @param num      页数
     * @param pagesize 每页多少条
     * @return
     */
    public DataResult getMessages(String docid, int num, int pagesize);

}